#ifndef  LEVELONE_HPP
# define LEVELONE_HPP

# include <Shinygami/Applejack/world.hpp>
# include <Shinygami/ui.hpp>
# include <Box2D/Dynamics/Contacts/b2Contact.h>

# include "control_config.hpp"

# include "fighter_michael.hpp"
# include "fighter_louis.hpp"
# include "fighter_yann.hpp"
# include "fighter_alex.hpp"

class Level1 : public Shiny::Applejack::Module
{
public:
    Level1(Shiny::Applejack::World& world, int countPlayers = 2);
    ~Level1()
    {
    }

    void AddPlayer(int numPlayer, const std::string& name, Shiny::Controls&);

    void Run(void);
    void FightOver(const std::string&);
    void ManageHits();
    void SetScreenSize(const sf::Vector2f&);

    void ExitLevel(sf::Event);

    Observatory::Signal<bool>    EndLevel;

private:
    Shiny::Controls                _controls;

    struct PlayerStruct
    {
      PlayerStruct(void) : camera(0), player(0), script(0), lifebar(0), defeated(false) {}

      Shiny::Applejack::View*      camera;
      Shiny::Applejack::Body*      player;
      Player*                      script;
      Shiny::Widgets::ProgressBar* lifebar;
      bool                         defeated;
    };

    float                        _countPlayers;
    PlayerStruct                 _players[4];
    Shiny::Widgets::Ui*          _hud;
    Shiny::Widgets::TextWidget*  _victoryText;

    Shiny::Applejack::View       *_camera1, *_camera2;
};

#endif
